/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.casestudy1.view;

import com.casestudy1.control.GetListLocation;
import com.casestudy1.main.MainMidlet;
import com.casestudy1.yuh.TrafficReportDetailForm;
import com.casestudy1.yuh.connServer;
import com.casestudy1.yuh.trafficReport;
import com.sun.lwuit.Command;
import com.sun.lwuit.List;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.SelectionListener;
import java.io.IOException;
import java.util.Vector;
import javax.microedition.media.MediaException;
import javax.microedition.midlet.MIDlet;

/**
 *
 * @author Lenovo
 */
public class ListCellIDHistory extends View {

    private MIDlet midlet;
    private List list;
    private Command cmd_back;

    public ListCellIDHistory(final MainMidlet midlet, String user) {
        super(midlet);
        final Vector vector = new GetListLocation().getAtUsername(user);
        list = new List();

        for (int i = 0; i < vector.size(); i++) {
//            trafficReport tr = (trafficReport) v.elementAt(i);
//            list.addItem(tr.getVitri() + " - " + tr.getKhuvuc());
        }

        list.addSelectionListener(new SelectionListener() {
            public void selectionChanged(int i, int i1) {
//                new TrafficReportDetailForm(midlet, (trafficReport) v.elementAt(i1)).show();
            }
        });

        addComponent(list);

        cmd_back = new Command("Back") {
            public void actionPerformed(ActionEvent evt) {
                try {
                    new BlockedTrafficForm(midlet).show();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (MediaException ex) {
                    ex.printStackTrace();
                }
            }
        };

        setBackCommand(cmd_back);
        addCommand(cmd_back);
    }
}
